<template>
    <div>
        <header class="resviseTop">
             <img src="../../images/left.png" alt=""  v-if="cliend==3" @click="backTao">
             <img src="../../images/left.png" alt="" onClick="javascript :history.back(-1);" v-else-if="cliend==1 || cliend==2 ||cliend==4">
             <span class="resvise_title">{{titile}}</span>
            <div v-if="cliend==1 || cliend==3 ||  cliend==4"><span @click="finished">完成</span></div>
        </header>

        <div v-if="cliend==1">
            <div class="write_QQ">
                <input type="text" v-model="number" placeholder="请输入QQ号码">
            </div>
            <p class="danger">注意：不能是手机号码或者邮箱</p>
        </div>
<!--请输入淘宝会员名-->
        <div v-else-if="cliend==3">
            <div class="write_QQ">
                <input type="text" v-model="Taonumber" placeholder="请输入淘宝会员名">
            </div>
            <p class="danger">注意：不能是手机号码或者邮箱</p>
        </div>
<!--修改昵称-->
        <div v-else-if="cliend==4">
            <div class="write_QQ">
                <input type="text" v-model="userName" placeholder="修改昵称">
            </div>
            <p class="danger">注意：不能是手机号码或者邮箱</p>
        </div>
<!--登录密码-->
        <div v-else-if="cliend==2">
             <input type="text" placeholder="请输入手机号码" class="tell_Number">
            <div class="yan_zheng">
                <input type="text" placeholder="请输入验证码">
                <span>获取验证码</span>
            </div>
            <div class='load_password'>
                <input type="text" placeholder="请输入登录密码" v-model="password">
                <img src="../../img_myself/close.png" alt="" @click="removeHtml">
            </div>
            <button class="put_information">提交</button>
        </div>
<!--背景颜色-->
        <div class="bg_clock"></div>
    </div>
</template>

<script>
    export default {
        name: "Reviseinformation",
        data:()=>({
            titile:'',
            number:'',
            Taonumber:'',
            userName:'',
            password:'',
            cliend:'' //标记  判断显示 1:qq信息  2:修改密码 3:修改淘宝名字 4:修改昵称
        }),
        methods:{
            finished:function(e){
                if(this.cliend==1){
                    var oVal = this.number
                    if(oVal==""){
                        alert('您没有输入任何内容')
                        this.number=''
                    }else if(isNaN(oVal)== true){
                        alert('您输入的不是qq号码')
                        this.number=''
                    }else if(parseFloat(oVal)!=parseInt(oVal)){
                        alert('您输入的不能是小数')
                        this.number=''
                    }else if(oVal.length>10 || 4>oVal.length){
                        alert('您输入的数字长度不合法')
                        this.number=''
                    }else if(oVal.charAt(0)=="0"){
                        alert('您输入的首个数字不能为0')
                        this.number=''
                    }else{
                        alert("修改成功！")
                        this.$router.push({path:'/task/Myinformation'})
                        localStorage.setItem('number',this.number)
                    }
                }else if(this.cliend==3){   //返回淘宝详情
                    alert("修改成功！")
                    this.$router.push({
                        name: 'detailsTao',
                        params:{
                            add_Tao:0
                        }
                    })
                    localStorage.setItem('Taonumber',this.Taonumber)
                }else if(this.cliend==4){   //返回修改昵称
                    alert("修改成功！")
                    this.$router.push({path:'/task/Myinformation'})
                    localStorage.setItem('userName',this.userName)
                }
              },
            backTao:function(){
                this.$router.push({
                    name: 'detailsTao',
                    params:{
                        add_Tao:0
                    }
                })
            },
            removeHtml:function(){
                this.password=''
            }
        },
        created(){
            this.cliend = this.$route.params.ifBer  //标识
            if(this.$route.params.ifBer==1){
                this.titile='QQ账号'
            }else if(this.$route.params.ifBer==2){
                this.titile='设置登录密码'
            }else if(this.$route.params.ifBer==3){
                this.titile='淘宝账号'
            }else if(this.$route.params.ifBer==4){
                this.titile='修改昵称'
            }
        }
    }
</script>

<style scoped="css">
    @import "../../style/reviseinformation.css";
</style>
